package com.ea.common.filter;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;

/**
 * @author NAME-L
 * @Description TODO
 * @className AuthFilter
 * @date 2022-03-28 22:15:22
 */
@Component
public class AuthFilter implements HandlerInterceptor {

    private static final Log logger = LogFactory.getLog(AuthFilter.class);

    public String getToken(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        if (StringUtils.isNotEmpty(token)) {
            logger.info("从前端获取token:" + token);
            return token;
        }
        return null;
    }

}
